/**
 * 
 */
package cn.maszy.action.systemsetting;


import org.springframework.beans.factory.annotation.Autowired;


import net.sourceforge.stripes.action.SessionScope;
import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.systemsetting.B_T_Ufp_Admin;
import cn.maszy.service.systemsetting.B_T_Ufp_AdminService;

/** 
 * @作者 Allen Shu 
 * @创建日期 2012-6-2 
 * @版本 V 1.0 
 */
@SessionScope
public class AdminAction extends BaseAction<B_T_Ufp_Admin>{
	/**
	 * 版本控制信息
	 */
	private static final long serialVersionUID = 6179604301571294802L;
	private B_T_Ufp_Admin b_T_Ufp_Admin;
	@Autowired
	private  B_T_Ufp_AdminService b_T_Ufp_AdminService;
	private String checkIds;
	/*********************class set/get****************************/	
	public B_T_Ufp_Admin getB_T_Ufp_Admin() {
		return b_T_Ufp_Admin;
	}
	public void setB_T_Ufp_Admin(B_T_Ufp_Admin b_T_Ufp_Admin) {
		this.b_T_Ufp_Admin = b_T_Ufp_Admin;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	/*******************STRUTS ACTION METHOD*************************/
	public String adminDelete() throws Exception {
		int i=b_T_Ufp_AdminService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "adminList","", "forward", "systemsetting/adminList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	public String adminUpdate() throws Exception {
		int i=b_T_Ufp_AdminService.update(b_T_Ufp_Admin);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "adminList", "closeCurrent", "investment/adminList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "adminList","", "forward", "systemsetting/adminList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	public String adminList() throws Exception {
		pager = new Pager<B_T_Ufp_Admin>(pageNum, numPerPage,orderField,orderDirection);
		pager= b_T_Ufp_AdminService.selectList(b_T_Ufp_Admin,pager);
		return SUCCESS;
	}
	public String adminDetail() throws Exception {
		if(b_T_Ufp_Admin==null){
			b_T_Ufp_Admin=b_T_Ufp_AdminService.selectOne("");
		}else{
			b_T_Ufp_Admin=b_T_Ufp_AdminService.selectOne(b_T_Ufp_Admin.getAdminId());
		}
		return SUCCESS;
	}

}
